package institution

import (
	"net/http"

	"github.com/EDDYCJY/go-gin-example/pkg/app"
	"github.com/EDDYCJY/go-gin-example/pkg/e"
	"github.com/EDDYCJY/go-gin-example/pkg/util"
	"github.com/EDDYCJY/go-gin-example/service/institution_service"
	"github.com/gin-gonic/gin"
)

type GetBillVerify struct {
}

func GetBill(c *gin.Context) {
	var (
		appG = app.Gin{C: c}
		form GetBillVerify
	)
	_, errCode := app.BindAndValidMsg(c, &form)
	if errCode != nil {
		appG.ResponseMsg(errCode, nil)
		return
	}

	InstitutionID := c.MustGet("institution_id").(int)
	Service := institution_service.GetBill{
		InstitutionID: InstitutionID,
		PageNum:       util.GetPage(c),
		PageSize:      util.GetLimit(c),
	}
	data, err := Service.GetBill()
	if err != nil {
		appG.ResponseMsg(err, nil)
		return
	}
	//异步日志
	appG.Response(http.StatusOK, e.SUCCESS, data)

}
